/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;

/**
 *
 * @author Stefan Martinov <stefan.martinov@gmail.com>
 */
public class FacesUtils {

    public static void throwFacesException(String component,String text, FacesContext context) {
        FacesMessage message = new FacesMessage();
        message.setSeverity(FacesMessage.SEVERITY_ERROR);
        message.setSummary(text);
        message.setDetail(text);
        FacesContext.getCurrentInstance().addMessage(component, message);
    }
}
